package com.mysoft.gfyx.clue.controller;

import com.mysoft.framework.modeling.dto.ListDataResult;
import com.mysoft.framework.modeling.dto.LoadDataParams;
import com.mysoft.framework.mvc.api.Controller;
import com.mysoft.framework.rpc.annotation.PubAction;
import com.mysoft.framework.rpc.annotation.PubService;
import com.mysoft.framework.rpc.contants.RequestPrefix;
import com.mysoft.gfyx.clue.controller.dto.Subscription.AddProjectSubscriptionRequestDto;
import com.mysoft.gfyx.clue.service.SubscriptionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@PubService(value = "/projectSubscriptionPub", prefix = RequestPrefix.PUB)
public class ProjectSubscriptionPubController extends Controller {

    @Resource
    private SubscriptionService subscriptionService;

    @PubAction(value = "/projectSubscription", method = RequestMethod.POST)
    @ApiOperation(value = "/projectSubscription", notes = "项目订阅列表")
    public ListDataResult projectSubscription(@RequestBody LoadDataParams options) {
        return subscriptionService.loadProjectSubscriptionData(options);
    }

    @PubAction(value = "/addProjectSubscription", method = RequestMethod.POST)
    @ApiOperation(value = "/addProjectSubscription", notes = "添加项目订阅")
    public Boolean addProjectSubscription(@RequestBody AddProjectSubscriptionRequestDto dto) {
        return subscriptionService.addProjectSubscription(dto);
    }
}
